package main

import (
	"github.com/gin-gonic/gin"
	"net/http"
)
/*
	自定义中间件，将login.html中获取的请求参数传递给loginUserStatus.html展示
 */
func Test() gin.HandlerFunc{
	return func(c *gin.Context) {

		c.HTML(http.StatusOK,"loginUserStatus.html",gin.H{
			"username" : c.PostForm("username"),
			"password" : c.PostForm("password"),
		})
	}
}

func main(){

	//New()函数创建空的engine
	engine := gin.New()
	engine.Use(Test())//使用自定义的中间件
	engine.LoadHTMLGlob("template/*")//指定模板路径
	engine.GET("/login",func(c *gin.Context) {
	})

	engine.Run()

}
